# rootdir normalization
override rootdir := $(abspath ${rootdir})

ifeq ($(origin builddir), undefined)
    builddir = $(abspath ${rootdir}/build)
endif

ifeq ($(origin toolchain), undefined)
    toolchain = gcc
endif
ifeq ($(origin mode), undefined)
    mode = release
endif
include ${rootdir}/mk/toolchain_${toolchain}.mk

CPP_FLAGS += -c -Wall -pedantic -I${rootdir}
DEPENDSWITCHES += -MG -MM

ifeq ($(strip ${mode}),debug)
    CPP_FLAGS += -ggdb
    STRIP =
else
    STRIP = strip --strip-all ${1}
endif

ifeq ($(strip $(LIBSSH_DIR)),YES)
    CPP_FLAGS += -I$(LIBSSH_DIR)/include
    LD_FLAGS += -L$(LIBSSH_DIR)/lib
endif

LD_FLAGS += -lssh -lpthread -lboost_thread -lboost_system
